<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\PrescriptionDisease
 *
 * @property int $id
 * @property int $prescription_info_id 处方信息id
 * @property int $disease_id 疾病id
 * @property string|null $disease_name 疾病名称
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\PrescriptionDisease onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease whereDiseaseId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease whereDiseaseName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease wherePrescriptionInfoId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\PrescriptionDisease whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\PrescriptionDisease withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\PrescriptionDisease withoutTrashed()
 * @mixin \Eloquent
 */
class PrescriptionDisease extends Model
{
    //
    use SoftDeletes;

    public static function getPrescriptionDiseaseList($prescription_info_id = 0){
        $data = [];
        $prescriptionDiseaseList = self::wherePrescriptionInfoId($prescription_info_id)->get();
        if(count($prescriptionDiseaseList) > 0){
            foreach ($prescriptionDiseaseList as $prescriptionDisease) {
                array_push($data,$prescriptionDisease->disease_name);
            }
        }

        return $data;
    }
}
